package com.grm.task.manager.mapper;

import com.grm.task.manager.entity.Task;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TaskMapper {
    void batchInsertTasks(@Param("tasks") List<Task> tasks);

    void batchInsertTasksAndSetStatus(@Param("tasks") List<Task> tasks,@Param("status") Integer status);

    List<Task> queryTasksByStatusAndType(@Param("status")Integer status,@Param("type")Integer type);

    List<Task> queryTasksByNames(@Param("tasks") List<String> taskNames);

    Long queryMaxOrderNumByType(@Param("type")Integer type);

    List<Task> queryTasksAllByType(@Param("type")Integer type);

    Task queryLastedRunningTask(@Param("type")Integer type,@Param("status")Integer status);

    void incrementOrderNum(@Param("status")Integer status,@Param("orderNum")Long orderNum);

    void updateTaskOrderNum(@Param("id")Long id, @Param("orderNum")Long orderNum);
}
